package com.enzo.prms.common.base.service;

import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;

import com.enzo.prms.common.base.to.BaseEntity;
import com.enzo.prms.common.exception.base.ServiceException;


public interface BaseService<T extends BaseEntity> {

    public void save(T obj)throws ServiceException;

    public void delete(T obj);
    
    public void delete(Integer id);

    /**
     * not delete truly,set flag to zero
     * @param clazz
     * @param id
     * @throws ServiceException
     */
    public void remove(Integer id) throws ServiceException;

    public void update(T obj)throws ServiceException;

    public T getById(Integer id);

    public T load(Integer id);
    
    public void executeByHql(final String hql,final Map<String, Object> params)throws ServiceException;
    
    public List<T> getListByCriteria(final DetachedCriteria criteria)throws ServiceException;
    
    public List<T> getListByHQL(String hql,Map<String, Object> params);
    
    public List<T> getListBySQL(String hql,Map<String, Object> params);
    
    public List<T> getListByNamedSQL(String sqlName, Map<String, Object> params);
    
    public long count(String sql);
    
    public List<T> getListForPage(String sql,Map<String, Object> params,int offset,int length);
    
}
